import React, {useEffect, useState} from 'react';
import useOpenid from "@/pages/wx/use/useOpenid";
import {DotLoading} from "antd-mobile";
import qs from "qs";
function Index(props) {
    const [status, setStatus] = useState(false),
        {openid} = useOpenid();

    useEffect(() => {
        if (openid){
            const id = qs.parse(location.search)["?id"] || qs.parse(location.search)["id"]
            if (id){
                ax.post("/gzh/bindAccount",{
                    id:+id,
                    openid
                }).then(res=>{
                    setStatus(true)
                })
            }

        }
    }, [openid])

    return (
        <div style={{
            display:'flex',
            justifyContent:"center",
            alignItems:"center",
            height:"100vh"
        }}>
            {
                status?<h3>绑定成功</h3>:<div style={{ color: '#00b578' }}>
                    <DotLoading />
                    <span>绑定中</span>
                </div>
            }

        </div>
    );
}

export default Index;